#include "xdialogtransaction.h"
#include <string.h>
#include "xrequest.h"
#include "xdialog.h"
#include "libxsip.h"
#include "xsip.h"

XSIPDialogTransaction::XSIPDialogTransaction(int type)
	: XSIPTransaction(type)
{

}

XSIPDialogTransaction::~XSIPDialogTransaction()
{

}

void* XSIPDialogTransaction::getObject(const char* name) const
{
	if (strcmp(name, "XSIPDialogTransaction") == 0)
		return const_cast<XSIPDialogTransaction*>(this);
	else
		return XSIPTransaction::getObject(name);
}

void XSIPDialogTransaction::onEvent(XSIPTransaction* transaction, int eventCode)
{
	XSIPDialog* dialog = (XSIPDialog*) m_owner->getObject("XSIPDialog");
	dialog->onEvent(transaction, eventCode);
	DeleteCall* del = new DeleteCall(dialog);
	XSIPEngine::getCurrentThreadEngine()->addEntry(del);
}
